// pages/record/record.js
var app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    nickName:"",
    avatarUrl:"",
    name:"",
    identity:"",
    student_No:""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var nickName = app.globalData.nickName
    var avatarUrl = app.globalData.avatarUrl
    var name = app.globalData.name
    var student_No = wx.getStorageSync("username")
    var identity = app.globalData.identity
    var header = app.globalData.header
    if (identity === "student") {
      identity = "学生"
      that.setData({
        identity: identity,
      })
    } else {
      identity = "教师"
      that.setData({
        identity: identity,
      })
    }
    this.setData({
      nickName: nickName,
      avatarUrl: avatarUrl,
      name: name,
      student_No: student_No
    })
    wx.request({
      url: 'http://139.199.192.171:8080/nanitao/attence_record/list.action',
      header: header,
      data:{
        stu_num:16052036
      },
      method:"GET",
      success:function(res){
        var data = res.data
        var long = data.length
        // console.log(data)
        that.setData({
          list:data,
          long:long
        })

      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})